//package com.geely.pma.climate.api.single
package com.wanghaibo.vgashow.api.single


import com.ecarx.xui.adaptapi.car.base.ICarFunction
import io.reactivex.SingleEmitter

/**
 * Name: GetFunctionValue
 *
 * Created by Wuhao on 2020/6/2
 *
 * Version: 0.0.1
 */
class GetFunctionValueTask(
    emitter: SingleEmitter<Int>,
    private val function: Int,
    private val zone: Int?
) : SingleOperation<Int>(emitter) {

    override fun onInitialized(carFunction: ICarFunction) {
        if (zone == null) {
            emitter.onSuccess(carFunction.getFunctionValue(function))
        } else {
            emitter.onSuccess(carFunction.getFunctionValue(function, zone))
        }
    }

}